import { createRouter, createWebHistory } from "vue-router";
import Index from "../views/Index.vue";

const pages = [
  {
    path: "/home",
    name: "home",
    meta: {
      name: "首頁",
      type: 0,
      icon: "home",
    },
    component: () => import("../views/pages/Home.vue"),
  },
  {
    path: "/userList",
    name: "userList",
    meta: {
      name: "用戶管理",
      type: 0,
      icon: "user",
    },
    component: () => import("../views/pages/UserList.vue"),
  },
  {
    path: "/teacherList",
    name: "teacherList",
    meta: {
      name: "教師管理",
      type: 0,
      icon: "teacher",
    },
    component: () => import("../views/pages/TeacherList.vue"),
  },
  {
    path: "/gptList",
    name: "gptList",
    meta: {
      name: "GPT 設定",
      type: 0,
      icon: "gpt",
    },
    component: () => import("../views/pages/GptList.vue"),
  },
  {
    path: "/settingList",
    name: "settingList",
    meta: {
      name: "個人設定",
      type: 0,
      icon: "setting",
    },
    component: () => import("../views/pages/SettingList.vue"),
  },
  {
    path: "/gptRoleList",
    name: "gptRoleList",
    meta: {
      name: "GPT角色",
      type: 0,
      icon: "setting",
    },
    component: () => import("../views/pages/GptRoleList.vue"),
  },
  {
    path: "/inviteList",
    name: "inviteList",
    meta: {
      name: "邀请列表",
      icon: "setting",
      type: 1,
    },
    component: () => import("../views/pages/InviteList.vue"),
  },
  {
    path: "/studyList",
    name: "studyList",
    meta: {
      name: "学生列表",
      icon: "setting",
      type: 1,
    },
    component: () => import("../views/pages/StudyList.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "index",
      component: Index,
      // redirect: '/home',
      children: pages,
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../views/Login.vue"),
    },
  ],
});

export { router, pages };
